package com.vortex.cloud.sample.easyexcel.kuangshen.poi.read;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * @author 王林
 * @version 1.0
 * @date 2021-10-15 周五
 * @time 11:51
 * @description
 */
public class ReadTest07 {
    public static void main(String[] args) throws IOException {
        String PATH = "H:\\fuTaiPorjects\\backend\\hw-clouc-sample-easyExcel\\";


        //获取文件流
        FileInputStream fileInputStream = new FileInputStream(PATH + "hw-clouc-sample-easyExcel王林观众统计表07.xlsx");

        //1-创建一个工作簿，使用excel操作的，这边都可以操作
        Workbook workbook = new XSSFWorkbook(fileInputStream);

        //2-得到表
        Sheet sheet = workbook.getSheetAt(0);

        //3-得到行
        Row row = sheet.getRow(0);

        //4-得到列   读取时一定要注意类型
        Cell cell = row.getCell(0);
        System.out.println(cell.getStringCellValue());

        Cell cell1 = row.getCell(1);
        System.out.println(cell1.getStringCellValue());
        fileInputStream.close();
    }
}
